package com.ddw.meedeeuh.shared;

import java.util.logging.Level;

/**
 * Represents the global settings implementation
 * @author cmcnicholas
 *
 */
class GlobalSettingsImpl implements GlobalSettings {

	private boolean fileLogEnabled;
	private Level logLevel;

	/**
	 * Creates a new global settings instance
	 * @param fileLogEnabled whether file logging is enabled
	 * @param logLevel the log level
	 */
	public GlobalSettingsImpl(boolean fileLogEnabled, Level logLevel) {
		if(logLevel == null) {
			throw new IllegalArgumentException("The log level parameter cannot be null");
		}

		this.fileLogEnabled = fileLogEnabled;
		this.logLevel = logLevel;
	}

	@Override
	public boolean isFileLogEnabled() {
		return this.fileLogEnabled;
	}

	@Override
	public void setFileLogEnabled(boolean enabled) {
		this.fileLogEnabled = enabled;
	}

	@Override
	public Level getLogLevel() {
		return this.logLevel;
	}

	@Override
	public void setLogLevel(Level level) {
		if(level == null) {
			throw new IllegalArgumentException("The level parameter cannot be null");
		}

		this.logLevel = level;
	}

}
